Fast Lowest Common Ancestor Computations in Dags
نویسندگان
چکیده
This work studies lowest common ancestor problems in directed acyclic graphs. We present fast algorithms for solving the All-Pairs Representative LCA and AllPairs All LCA problems with expected running time of O(n2 log n) and O(n3 log log n) respectively. The speed-ups over recently developed methods are achieved by applying transitive reduction on the input dags. The algorithms are experimentally evaluated against previous approaches demonstrating a significant improvement. On the purely theoretical side, we improve the upper bound for All-Pairs Representative LCA to O(n2.575) and the upper bound for All-Pairs All LCA to O(n3.3399). We give first fully dynamic algorithms for both All-Pairs Representative LCA and All-Pairs All LCA . Here, the update complexities are O(n2.5) and O(n3) respectively, with constant query times.
منابع مشابه
Improved Algorithms for the All-pairs Lowest Common Ancestor Problem in Directed Acyclic Graphs
We present a new algorithm for solving the all-pairs lowest common ancestor problem in directed acyclic graphs (dags). Our algorithm runs in time O(n), where λ satisfies the equation ω(1, λ, 1) = 1 + 2λ and ω(1, λ, 1) is the exponent of the multiplication of an n × n matrix by an n × n matrix. By the currently best bounds on ω(1, λ, 1), the running time of our algorithm is O(n). Our algorithm i...
متن کاملComputing Lowest Common Ancestors in Directed Acyclic Graphs
Finding the lowest common ancestor of a given pair of nodes is a fundamental algorithmic problem. In this paper we study the lowest common ancestor(LCA) problem on directed acyclic graphs (DAGs). A lowest common ancestor of two nodes a and b is a node c which is a common ancestor of a and b and no other node is both a common ancestor of a and b and a proper descendant of c. LCA on trees have be...
متن کاملAll-Pairs Common-Ancestor Problems in Weighted Dags
This work considers the (lowest) common ancestor problem in weighted directed acyclic graphs. The minimum-weight (lowest) common ancestor of two vertices is the vertex among the set of (lowest) common ancestors with the smallest ancestral distance. For the all-pairs minimum-weight common ancestor problem we present an O(nm) algorithm for arbitrary edge weights which is optimal for sparse graphs...
متن کاملFaster algorithms for finding lowest common ancestors in directed acyclic graphs
We present two new methods for finding a lowest common ancestor (LCA) for each pair of vertices of a directed acyclic graph (dag) on n vertices and m edges. The first method is surprisingly natural and solves the all-pairs LCA problem for the input dag on n vertices and m edges in time O(nm). The second method relies on a novel reduction of the all-pairs LCA problem to the problem of finding ma...
متن کاملNew common ancestor problems in trees and directed acyclic graphs
We derive a new generalization of lowest common ancestors (LCAs) in dags, called the lowest single common ancestor (LSCA). We show how to preprocess a static dag in linear time such that subsequent LSCA-queries can be answered in constant time. The size is linear in the number of nodes. We also consider a “fuzzy” variant of LSCA that allows to compute a node that is only an LSCA of a given perc...
متن کامل